import vue from '@vitejs/plugin-vue'

let index = 0
export default {
    plugins: [vue()],
    optimizeDeps: {
    },
    server:{
        strictPort: false,
        proxy: {
            '/api2': {
                target: 'http://localhost:9882',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api2/, '')
            },
        }   
    },
    css: {
      preprocessorOptions: {
        // less: {
        //   javascriptEnabled: true
        // }
        scss: {
          javascriptEnabled: true
        }
      }
    },
    build:{
        rollupOptions:{
          output:{
            manualChunks(id){
              if(id.includes('node_modules')){
                return id.toString().split('node_modules/')[1].split('/')[0].toString()
              }
              if (__dirname.length > 0 && id.substring(0, __dirname.length).replace(/\\/g, '/') == __dirname.replace(/\\/g, '/')) {
              }
            },
            entryFileNames: `assets/[name].[hash].js`,
            chunkFileNames: `assets/[name].[hash].js`,
            assetFileNames: `assets/[name].[hash].[ext]`,
          }
        }
    }

}